/**
 * Project Name:kany-utils
 * File Name:ImagePanel.java
 * Package Name:me.kany.utils.swt.panel
 * Date:2016年5月3日上午11:40:01
 * Copyright (c) 2016, Jason.Wang All Rights Reserved.
 *
*/

package me.kany.utils.swt.panel;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;

import javax.swing.JPanel;

/**
 * ClassName:ImagePanel <br/>
 * Function: 自定义重绘图片背景. <br/>
 * Date: 2016年5月3日 上午11:40:01 <br/>
 * 
 * @author Jason.Wang
 * @version
 * @since JDK 1.7
 * @see
 */
@SuppressWarnings("serial")
public class ImagePanel extends JPanel {
	
	private Image image;

	public ImagePanel() {
	}

	public ImagePanel(Image image) {
		this.image = image;
	}

	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponents(g);
		Graphics2D gs2d = (Graphics2D) g;
		gs2d.drawImage(this.image, 0, 0, null);
	}
}
